﻿<!-- Phan khai bao bien cuc bo-->
<?php
$v_record_id = 0;
if(isset($_REQUEST['hdn_record_id'])){
	$v_record_id = intval($_REQUEST['hdn_record_id']);
}
if ($v_record_work_id >0) {
	$v_record_work_id = $arr_single_record_work['PK_RECORD_WORK'];
	$v_record_id = $arr_single_record_work['FK_RECORD'];
	$v_worker = $arr_single_record_work['FK_WORKER'];
	$v_record_work_worktype = _replace_bad_char($arr_single_recordwork_by_recordtype_thue['PK_WORKTYPE']);
	
	$v_date = _yyyymmdd_to_ddmmyyyy($arr_single_record_work['C_DATE']); 
	$v_result = $arr_single_record_work['C_RESULT']; 
	$v_file_name = $arr_single_record_work['C_FILE_NAME'];
	$v_system_worktype = $arr_single_record_work['C_SYSTEM_WORKTYPE'];
	$v_readonly = "readonly";
}else{
	$v_record_work_id = 0;
	$v_date = date('d/m/Y');
	//Leav_update:25/06/08,continue :13092008
	$v_result = _CONST_TEXTAREA_RESULT_NOTIFY;
	//Leav_update:25/06/08
	$v_readonly = "";
}
$v_display = "none";
if ($v_count_worktype > 0){
	$v_display = "block";
}
$v_hight_list = "120px";
if ($v_record_work_id>0){
	$v_hight_list = "25px";
}

$v_file_url = trim(CONST_URL_PATH_FROM_ROOT) . $v_file_name;
//echo $v_file_name;
$v_goto_url = "javascript:filename_onclick('T_ONEGATE_RECORD_WORK', 'PK_RECORD_WORK', 'C_FILE_NAME', 'C_FILE_CONTENT'," . strval($v_record_work_id) . ",'" . $v_file_url ."');" ;
?>
<!--bang chua tieu de cua form-->
<table width="100%" cellpadding="0" cellspacing="0">
	<tr class="large_title">
		<td><?php if($c_details_status==24){
			echo $v_title_thue;
		}elseif($c_details_status==25){
			echo $v_title_phat;
		}else{
		echo $v_title_khong_phat;
		}?></td>
	</tr>
</table>
<!-- Bat cac phim: F12=true; Insert=false; Delete=false, ESC=true; Enter=true -->
<div id="hotkey" onKeyDown="javascript:process_hot_key(true,false,false,true,true);">
<!--bang chua cac text box de nhap du lieu-->
<table width="100%" class="form_table1" border="0" cellpadding="0" cellspacing="0" >
	<col width="18%"><col width="32%"><col width="31%"><col width="19%">
	<tr>
		<form action="index.php" method="post" name="f_dsp_single_record_work" enctype= "multipart/form-data">
		<input type="hidden" name="fuseaction" value="UPDATE_RECORD_WORK" >
		<input type="hidden" name="hdn_record_work_id" value="<?php echo $v_record_work_id;?>" >
		<input type="hidden" name="hdn_record_id"  value="<?php echo $v_record_id; ?>">
		<input type="hidden" name="hdn_recordtype_filter" value="<?php echo $v_recordtype_filter; ?>">
		<input type="hidden" name="hdn_work" value="<?php echo $v_record_work_worktype;?>">
		<input type="hidden" name="hdn_record_id_list" value="<?php echo $_v_list_record_id;?>">
	</tr>
	<tr>
		<td colspan="10">
		<?php 
		$strHTML = "";
		$strHTML = $strHTML . "<table width='99%' cellpadding='0' cellspacing='0'>";
		$strHTML = $strHTML . "<col width='25%'><col width='75%'>";
		$strHTML = $strHTML . "<tr>";
		$strHTML = $strHTML . "<td class='normal_label'>Lo&#7841;i h&#7891; s&#417;</td>";
		$strHTML = $strHTML . "<td class='normal_label' colspan='3'>$v_recordtype_name2</td>";
		$strHTML = $strHTML . "</tr>";
		$strHTML = $strHTML . "<tr>";
		$strHTML = $strHTML . "<td class='normal_label'>"._CONST_RADIO_LABEL_NOTIFY_DSHS."</td>";
		$strHTML = $strHTML . "<td class='normal_label' colspan='3'>$v_c_code</td>";
		$strHTML = $strHTML . "</tr>";
		$strHTML = $strHTML . "</table>";
		echo $strHTML;
		?>
		</td>
	</tr>
	<tr>
		<td colspan="11"><hr color="#66CCFF" width="100%" size="1"></td>
	</tr>
	<tr >
		<td align="left" class="normal_label"><?php echo CONST_RECORD_REALIZE_DATE_LABEL.":";?></td>
		<td colspan="2">
			<input type="text" name="txt_date" readonly <?php //echo $v_readonly;?> class="normal_date_textbox" isdate = "true" optional="<?php echo CONST_DATE_OPTIONAL; ?>" message = "<?php echo CONST_DATE_MESSAGE; ?>" value="<?php echo $v_date; ?>" onKeyDown="change_focus(document.forms(0),this);"><?php
			if ($v_record_work_id <= 0 && 1==2){?>
			<img src="<? echo $_ISA_IMAGE_URL_PATH;?>calendar.gif" border="0" onclick="DoCal('<?php echo $_ISA_LIB_URL_PATH; ?>isa-calendar/',document.forms(0).txt_date);" style="cursor:hand;"><?php
			}?>
		</td>		
	</tr>
	<!-- ///////////////////////////////////////////////////////////////////////////////-->
	<tr id="tr_leaders" style="display:block">
		<td class="normal_label" valign="top"><?php echo CONST_LANH_DAO_PHE_DUYET_TP;?><small class="normal_starmark">*</small></td>
	<td>
	<table>
	<?php 
	$p_arr_all_recordtype = $_SESSION["recordtype"];
	$v_sizeof=sizeof($p_arr_all_recordtype);
	
	if ($v_recordtype_filter !=""){
					for($i=0; $i< sizeof($p_arr_all_recordtype); $i++){
						if ($p_arr_all_recordtype[$i]['PK_RECORDTYPE'] == $v_recordtype_filter ){
							//lay ra tat ca nhung can bo phe duyet ho lan 1 :
								//column =FK_HANDLE_LEADER_FIRST_TIME -->can bo phe duyet lan 1
								//column =FK_HANDLE_LEADER -->can bo phe duyet lan 2
								//column =FK_APPROVE_LEADER_LIST -->can bo phe duyet lan 3 (lan cuoi)
							$v_handle_leader_first_time_list = $p_arr_all_recordtype[$i]['FK_HANDLE_LEADER_FIRST_TIME'];
							$v_arr_handle_leader_first_time_list = explode(",", $v_handle_leader_first_time_list);
							
							$v_handle_leader_secord_time_list = $p_arr_all_recordtype[$i]['FK_HANDLE_LEADER'];
							$v_arr_handle_leader_secord_time_list = explode(",", $v_handle_leader_secord_time_list);
							
							$v_handle_approve_leader_list = $p_arr_all_recordtype[$i]['FK_APPROVE_LEADER_LIST'];
							$v_arr_handle_approve_leader_list = explode(",", $v_handle_approve_leader_list);
							break;
						}
						
					}
	}	
	/*	
	$is_chuyen_thang_hs_cho_ldpd=is_contain_config($v_c_system_conf,'CHUYEN_HS_TP_LDPD');
	$is_hs_trinh_ld_lan_cuoi=is_contain_config($v_c_system_conf,'TRINH_LDLC_TP');
	
	if($fuseaction=="DISPLAY_NOTIFY_2"){
		$v_size_leader=sizeof($v_arr_handle_leader_secord_time_list);
		$_arr_leader=$v_arr_handle_leader_secord_time_list;
	}elseif($fuseaction=="DISPLAY_NOTIFY_3"){
		$v_size_leader=sizeof($v_arr_handle_approve_leader_list);
		$_arr_leader=$v_arr_handle_approve_leader_list;
	}else{*/
	$v_lan="";
	if(in_array($_SESSION['staff_id'],$v_arr_handle_leader_first_time_list) && !in_array($_SESSION['staff_id'],$v_arr_handle_leader_secord_time_list)){
		$v_size_leader=sizeof($v_arr_handle_leader_secord_time_list);
		$_arr_leader=$v_arr_handle_leader_secord_time_list;
		$v_lan=2;
	}else{
		$v_size_leader=sizeof($v_arr_handle_approve_leader_list);
		$_arr_leader=$v_arr_handle_approve_leader_list;
		$v_lan=3;
	}
	//}
	
	//12092008
	$v_checked="";
	for($i = 0; $i < $v_size_leader; $i++) {
		if($i==0){
			$v_checked="checked";
		}
		$v_leader_name = "<b><font color='#0099FF'>" . _get_item_attr_by_id($_SESSION['arr_all_staff'],$_arr_leader[$i], 'name') . "</font></b>";
	?>
	 <tr class="normal_label" >
		<td height="37"></td>		
			<td><input type="radio" name="rad_status" value="<?php echo $_arr_leader[$i]; ?>"  optional="true" message = "<?php echo CONST_WORKTYPE_MESSAGE; ?>" readonly="true" <?php echo $v_disable;?> <?php echo $v_checked;?> ><?php echo "&nbsp;".$v_leader_name; $v_dem++; ?>
			</td>
	</tr>
<?php $v_checked="";}?>
	</table>
	</td>	
	</tr>
	<tr>
	<td colspan="11"><hr color="#66CCFF" width="100%" size="1"></td>
	
	</tr>
<!-- ///////////////////////////////////////////////////////////////////////////////-->
	<tr style="display:<?php echo $v_display;?>">
		<td class="normal_label" valign="top"><?php echo CONST_LABEL_RESULT_APPROVE;?><small class="normal_starmark">*</small></td>
		<!--Day la cac radio load tu csdl de hien thi ----------------------------------------------------->
		<td colspan="10" align="left" >
			<DIV STYLE="overflow: auto; height:<?php echo $v_hight_list;?>; padding-left:0px;margin:0px">
				<table class="list_table_leav"  width="100%" cellpadding="0" cellspacing="0" >
					<col width="5%"><col width="95%">
				<?php if($c_details_status==24){?>
				<tr class="<?php echo $v_current_style_name;?>">
					<td >
					<input type="radio" name="opt_worktype_id" readonly="true" 
					message = "<?php echo CONST_WORKTYPE_MESSAGE; ?>" 
					value="TRINH_LDTB_THUE_L<?php echo $v_lan; ?>" <?php echo $v_checked;?> 
					onClick="rad_onclick_leav(this,document.forms(0).hdn_work);refuse_onclick_leav22(this)">
					</td>
					<td colspan="10" ><?php echo CONST_LABEL_LEADER_APPROVE_STRANFER_THUE;?></td>
					<td><input type="hidden" name="<?php echo $v_worktype_id;?>" value="<?php echo $v_worktype_name;?>"></td>
				</tr>
				<tr class="<?php echo $v_current_style_name;?>">
					<td >
					<input type="radio" name="opt_worktype_id" readonly="true" 
					message = "<?php echo CONST_WORKTYPE_MESSAGE; ?>" 
					value="LD_PHONG_TRALAI_THUE" <?php echo $v_checked;?> 
					onClick="rad_onclick_leav(this,document.forms(0).hdn_work);refuse_onclick_leav22(this)">
					</td>
					<td colspan="10" ><?php echo CONST_APPROVING_MOVE_BACK_LABEL;?></td>
					<td><input type="hidden" name="<?php echo $v_worktype_id;?>" value="<?php echo $v_worktype_name;?>"></td>
				</tr>
			<?php $v_checked = "";}?>
			<?php if($c_details_status==25){?>
				<tr class="<?php echo $v_current_style_name;?>">
					<td >
					<input type="radio" name="opt_worktype_id" readonly="true" 
					message = "<?php echo CONST_WORKTYPE_MESSAGE; ?>" 
					value="TRINH_LDTB_PHAT_L<?php echo $v_lan; ?>" <?php echo $v_checked;?> 
					onClick="rad_onclick_leav(this,document.forms(0).hdn_work);refuse_onclick_leav22(this)">
					</td>
					<td colspan="10" ><?php echo CONST_LABEL_LEADER_APPROVE_STRANFER_PHAT;?></td>
					<td><input type="hidden" name="<?php echo $v_worktype_id;?>" value="<?php echo $v_worktype_name;?>"></td>
				</tr>
				<tr class="<?php echo $v_current_style_name;?>">
					<td >
					<input type="radio" name="opt_worktype_id" readonly="true" 
					message = "<?php echo CONST_WORKTYPE_MESSAGE; ?>" 
					value="LD_PHONG_TRALAI_PHAT" <?php echo $v_checked;?> 
					onClick=		"rad_onclick_leav(this,document.forms(0).hdn_work);refuse_onclick_leav22(this)">
					</td>
					<td colspan="10" ><?php echo CONST_APPROVING_MOVE_BACK_LABEL;?></td>
					<td><input type="hidden" name="<?php echo $v_worktype_id;?>" value="<?php echo $v_worktype_name;?>"></td>
				</tr>
			<?php $v_checked = "";}?>
			<?php if($c_details_status==34){?>
				<tr class="<?php echo $v_current_style_name;?>">
					<td >
					<input type="radio" name="opt_worktype_id" readonly="true" 
					message = "<?php echo CONST_WORKTYPE_MESSAGE; ?>" 
					value="TRINH_LDTB_KHONG_PHAT_L<?php echo $v_lan; ?>" <?php echo $v_checked;?> 
					onClick="rad_onclick_leav(this,document.forms(0).hdn_work);refuse_onclick_leav22(this)">
					</td>
					<td colspan="10" ><?php echo CONST_LABEL_LEADER_APPROVE_STRANFER_NO_PHAT;?></td>
					<td><input type="hidden" name="<?php echo $v_worktype_id;?>" value="<?php echo $v_worktype_name;?>"></td>
				</tr>
				<tr class="<?php echo $v_current_style_name;?>">
					<td >
					<input type="radio" name="opt_worktype_id" readonly="true" 
					message = "<?php echo CONST_WORKTYPE_MESSAGE; ?>" 
					value="LD_PHONG_TRALAI_NO_PHAT" <?php echo $v_checked;?> 
					onClick=		"rad_onclick_leav(this,document.forms(0).hdn_work);refuse_onclick_leav22(this)">
					</td>
					<td colspan="10" ><?php echo CONST_APPROVING_MOVE_BACK_LABEL;?></td>
					<td><input type="hidden" name="<?php echo $v_worktype_id;?>" value="<?php echo $v_worktype_name;?>"></td>
				</tr>
			<?php $v_checked = "";}?>
			</table>
			</DIV>
		</td>
		<!--Day la cac radio load tu csdl de hien thi -->
	</tr>
	
	<tr id="tr_reason" class="normal_label" style="display:none" >
		<td height="37"><?php echo CONST_RECORD_REASON_LABEL; ?></td>
		<td><textarea name="txt_reason" class="normal_textarea" value="" row="4" style="width:100%" optional="true" message=""></textarea></td>
	</tr>
	<?php
	if (($v_record_work_id > 0)&&($v_file_name <> '')){?>
	<tr>
		<td class="normal_label"><?php echo CONST_ATTACH_FILE_LABEL; ?></td>
		<td class="normal_label" colspan="5" align="left">
			<a href="<? echo $v_goto_url; ?>" class="normal_link"><? echo $v_file_name;?></a>
		</td>
	</tr><?php
	}?>
	
</table>
<!--bang chua cac button-->
<table width="100%" >
	<tr>
		<td align="center" width="100%" height="40" valign="bottom"><?php
			//if (($v_record_work_id <=0) && ($v_id_staff_handler==$_SESSION['staff_id'])){?>
			<input type="button" name="btn_save"  class="normal_button" value="<?php echo _CONST_SAVE_BUTTON;?>" onClick="btn_save_thue_onclick('004','<?php echo date("d/m/Y");?>',document.forms(0).txt_date);" onKeyDown="change_focus(document.forms(0),this)"><?php
			//}?>
			<input type="button" name="btn_back" class="normal_button" value="<?php echo _CONST_BACK_BUTTON;?>" onClick="btn_back_onclick('<?php echo $_GO_BACK?>')" onKeyDown="change_focus(document.forms(0),this)">
		</td>
	</tr>
</table>					
</div>
</form>
<script language="JavaScript">
	set_focus(document.forms(0));
	window.dialogHeight = "340pt";
	window.dialogWidth = "420pt";
	window.dialogTop = "80pt";
</script>
			<!--
			<input type="button" name="btn_save"  class="normal_button" value="<?php echo _CONST_SAVE_BUTTON;?>" onClick="btn_save_onclick('UPDATE_RECORD_WORK');" onKeyDown="change_focus(document.forms(0),this)">
!-->